/**
 * Copyright (c) 2013, Andrea Funto'. All rights reserved.
 * 
 * This file is part of the Dihedron Concurrent Utilities library ("Concurrent").
 *
 * "Commons" is free software: you can redistribute it and/or modify it under 
 * the terms of the GNU Lesser General Public License as published by the Free 
 * Software Foundation, either version 3 of the License, or (at your option) 
 * any later version.
 *
 * "Concurrent" is distributed in the hope that it will be useful, but WITHOUT ANY 
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License 
 * along with "Concurrent". If not, see <http://www.gnu.org/licenses/>.
 */
package org.dihedron.concurrent;

import java.util.concurrent.Future;

/**
 * TaskExecutors are the classes that actually spawn background threads, or 
 * assign tasks to them. concrete instances act as adapters for ExecutoServices 
 * and asynchronous EJB 3.1 methods.
 *   
 * @author Andrea Funto'
 */
public interface TaskExecutor<T> {
	
	/**
	 * Assigns the given task to a background thread of execution and returns the
	 * correponding Future object.
	 * 
	 * @param task
	 *   the task to be executed.
	 * @return
	 *   the task's Future object, from which the result value can be retrieved.
	 */
	Future<T> submit(Task<T> task);
}
